package com.leff.cards.data;

import com.leff.cards.util.Secrets;
import com.leff.cards.util.Dictionary;

public class User implements Secrets, Comparable<User> {

	public long id;
	public long fbid;
	public String displayName;
	
	private User() {
	}
	
	public User(long _fbid, String _name) {
		id = -1;
		fbid = _fbid;
		displayName = _name;
	}
	
	@Override
	public String toString() {
		return id + ":" + fbid + " - " + displayName;
	}
	
	public static User fromDictionary(Dictionary dict) {
		
		User U = new User();
		
		U.id = (Long)dict.get("id");
		U.fbid = (Long)dict.get("fbid");
		U.displayName = (String)dict.get("name");
		
		return U;
	}

	@Override
	public int compareTo(User other) {
		return displayName.compareTo(other.displayName);
	}
}
